<template>

        <div class="layout-pd">
            <zh-header-toolbar>
                <zh-button style="margin-left: 8px" button-type="add" @click="addParams">新增参数</zh-button>
                <zh-button style="margin-left: 8px" button-type="edit" @click="editParams">编辑参数</zh-button>
                <zh-button style="margin-left: 8px" button-type="del" @click="deleteParams">删除</zh-button>
            </zh-header-toolbar>
            <zh-table
                    ref="apiParamsRef"
                    :columns="state.tableColumn"
                    model="apiParamsInfo">
                <template #status_edit="{ rows }">
                    <el-switch

                    ></el-switch>
                </template>
            </zh-table>
        </div>


</template>
<script lang="ts" setup name="apiInterfaceParams">
    import {FormInstance} from 'element-plus';
    //------------------接收传入参数(组件)-------------------

    //------------------定义子组件---------------------------
    const apiParamsRef = ref<any>({});
    //------------------内部变量定义-------------------------

    const state = reactive({
        tableColumn: [
            {
                type: 'radio',
                width: 40,
                fixed: 'left',
                align: 'center'
            },
            { type: 'seq',field: 'orderNo', width: 80, fixed: 'left', align: 'center', title: '序号' },
            { field: 'paramFrom', title: '参数类型', align: 'center', fixed: 'left', width: 100 },
            { field: 'paramField', title: '参数字段', fixed: 'left', align: 'center', width: 120 },
            { field: 'paramName', title: '字段中文描述', align: 'center', fixed: 'left', width: 120 },
            { field: 'paramValue', title: '默认值', align: 'center', width: 100  },
            {
                field: 'notNull',
                title: '是否必填',
                align: 'center',
                fixed: 'left',
                width: 100 ,
            },
            {
                field: 'fieldType',
                title: '数据类型',
                fixed: 'left',
                align: 'center',
                width: 100 ,
            },
            { field: 'paramFrom', title: '参数所属', align: 'center', width: 100  },
            { field: 'arrayTextSplit', title: '数组分隔符', align: 'center', width: 120 },
            { field: 'fieldFormat', title: '数据格式',  align: 'center', width: 100  },
            { field: 'textSplit', title: '文本分割符',  align: 'center', width: 120 },
            { field: 'parentId', title: '上级参数', align: 'center', width: 100  },
        ]
    });
    const apiParamsInfo = ref<any>({});
    const {isTagsview} = storeToRefs($store.theme);
    //------------------定义调用方法-------------------------
    function addParams(){
        const item ={

        };
        apiParamsRef.value.insert(item);
    }

    //------------------初始化------------------------------

    //------------设置给父组件调用的数据/方法(组件)-----------
    defineExpose({form: apiParamsRef,apiParamsInfo});
</script>
<style lang="scss" scoped></style>